package com.woniuxy.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.woniuxy.entity.BeforeQueryData;
import com.woniuxy.entity.UserApplyInfo;
import com.woniuxy.service.ContractService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;


/**
 * @author lawrence Z
 * 合同管理
 */
@RestController
@RequestMapping("/contractManager")
public class ContractManagerController extends BaseController {
    @Resource
    private ContractService contractService;

    @GetMapping("/contractList")

    public TableDataInfo contractList() {
        startPage();
        List<UserApplyInfo> list = contractService.contractList();
        return getDataTable(list);

    }

    /**
     *
     * @param datas
     * @return 搜索
     */
    @PostMapping("/contractSearch")
    public TableDataInfo contractSearch(@RequestBody BeforeQueryData datas) {

        startPage();
        System.out.println(datas);
        if (datas.getDates() != null) {
            if (datas.getDates().length == 0) {
                datas.setDates(null);
            }
        }
        List<UserApplyInfo> searchList = contractService.contractSearch(datas);
        return getDataTable(searchList);

    }
}




